package Day03;/*
超市购物小票：
  1.实现商品的信息（名称，单价，购买数量）录入
  2.展示商品的购买信息（数量，单价，金额）
  3.统计信息（总数量，总金额。。。）
 */
import java.util.Scanner;
public class SpuermarketTicket {
    public static void main(String[]args){
        //1.实现商品的信息（名称，单价，购买数量）录入
        Scanner scan=new Scanner(System.in);
        System.out.print("请录入第一件商品名称:");
        String goodsName1=scan.next();
        System.out.print("请录入第一件商品数量:");
        int goodQuantity1=scan.nextInt();
        System.out.print("请录入第一件商品单价:");
        double goodPrice1=scan.nextDouble();
        System.out.println("第一件商品录入成功");



        System.out.print("请录入第二件商品名称:");
        String goodsName2=scan.next();
        System.out.print("请录入第二件商品数量:");
        int goodQuantity2=scan.nextInt();
        System.out.print("请录入第二件商品单价:");
        double goodPrice2=scan.nextDouble();
        System.out.println("第二件商品录入成功");




        System.out.print("请录入第三件商品名称:");
        String goodsName3=scan.next();
        System.out.print("请录入第三件商品数量:");
        int goodQuantity3=scan.nextInt();
        System.out.print("请录入第三件商品单价:");
        double goodPrice3=scan.nextDouble();
        System.out.println("第三件商品录入成功");

        //2.展示商品的购买信息（数量，单价，金额）
        System.out.println("***欢迎来到旺旺超市***");
        System.out.println("-----------------------");
        System.out.println("商品名称    数量     单价    金额");
        double goodsAmount1=goodQuantity1*goodPrice1;
        double goodsAmount2=goodQuantity2*goodPrice2;
        double goodsAmount3=goodQuantity3*goodPrice3;

        System.out.println(goodsName1+"      "+goodQuantity1+"      "+goodPrice1+"      "+(goodsAmount1));
        System.out.println(goodsName2+"      "+goodQuantity2+"      "+goodPrice2+"      "+(goodQuantity2*goodPrice2));
        System.out.println(goodsName3+"      "+goodQuantity3+"      "+goodPrice3+"      "+(goodQuantity3*goodPrice3));




        //小票的统计信息
        System.out.println("-------------------");
        int TotalQuantity=goodQuantity1+goodQuantity2+goodQuantity3;//将三个商品的数量相加
        double TotalAmount=goodsAmount1+goodsAmount2+goodsAmount3;//每个商品的金额相加
        System.out.println("总数量:"+TotalQuantity);
        System.out.println("总金额:"+TotalAmount);

        //购买总数量超过10件或者总金额大于100,就在总价的基础上打五折
        double discountAmount=TotalQuantity>=10||TotalAmount>100?TotalAmount*0.5:TotalAmount;
        System.out.println("已优惠金额:"+(TotalAmount-discountAmount));
        System.out.println("实付金额:"+discountAmount);
    }
}
